{extend name="Base/common" /}
{block name="content"}
<!-- BEGIN PAGE -->

<div class="page-content" style="padding-top: 10px;">

    <div class="container-fluid">
        <!-- 面包屑开始-->
        <div class="row-fluid">
            <div class="span12">

                <!-- BEGIN PAGE TITLE & BREADCRUMB-->
                <h3 class="page-title">
                    招工类型列表
                </h3>
                <ul class="breadcrumb">
                    <li>
                        <a href="/ops/category/index">列表</a>
                        <i class="icon-angle-right"></i>
                    </li>
                    <li>
                        招工类型列表
                    </li>

                </ul>
                <!-- END PAGE TITLE & BREADCRUMB-->
            </div>
        </div>
        <!-- 面包屑结束 -->

        <!-- 带全选的表格开始 -->
        <div class="row-fluid">

            <div class="span12">

                <!-- BEGIN SAMPLE TABLE PORTLET-->

                <div class="portlet">

                    <div class="portlet-title">

                        <div class="caption"><i class="icon-reorder"></i>列表</div>

                        <!-- 表格内容整体操作结束 -->

                    </div>


                    <div style="margin-bottom: 20px;">
                        <button class="layui-btn btn-success" onclick="add()">添加</button>
                    </div>

                    <div class="portlet-body no-more-tables">

                        <table class="table-bordered table-striped table-condensed cf" style="text-align: center;">

                            <thead class="cf">

                            <tr>
                                <th>Id</th>

                                <th>名称</th>

                                <th>操作</th>

                            </tr>

                            </thead>

                            <tbody>

                            {volist name="list" id="vo"}
                            <tr class="">

                                <td>{$vo.id}</td>

                                <td>{$vo.name}</td>
                                <td>
                                    <a href="javascript:;" onclick="delete1('{$vo.id}', this); return false;">删除</a> |
                                    <a href="javascript:;" onclick="edit1('{$vo.id}'); return false;">编辑</a>

                                </td>

                            </tr>
                            {/volist}

                            </tbody>

                        </table>

                    </div>

                </div>
                {$list->render()}
                <!-- END SAMPLE TABLE PORTLET-->

            </div>
        </div>
        <!-- 带全选的表格结束btn-sort-edit -->

    </div>
</div>

<script>

    function add() {
        layui.use('layer', function (e) {
            var open = layer.open({
                type: 2,
                content: '/ops/category/add',
                area: ['500px', '300px'],

            });
            layer.full(open);
        })
    }

    function delete1(id, oj) {

        layui.use('layer', function () {

            layer.open({
                content: '确认删除吗？',
                yes: function (index, layero) {
                    //do something
                    var parent_id = $('#parent_id').val();
                    var name = $('#name').val();

                    $.post('/ops/category/delete', {id: id}, function (res) {
                        var res = JSON.parse(res);
                        if (res.errno == 0) {
                            layer.msg('操作成功');
                            $(oj).parent().parent().remove();
                        } else {
                            layer.msg(res.msg, function (e) {

                            })
                        }

                        return false;
                    });

                    return false;
                }
            })
        })

    }

    function edit1(id) {
        layui.use('layer', function(){
            layer.open({
                type: 2,
                area: ["600px", "400px"],
                content: '/ops/category/edit?id='+id //这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
            });

        });
    }


</script>
<!-- END PAGE -->
{/block}